<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="thx" uri="/thx-tags"%>
<style>
.form-horizontal .form-group {
	margin-right: 0px;
	margin-left: 0px;
}
</style>

<!-- Main content -->
<section class="content">
	<div class="page-header">
	  <h1 class="text-center">${view.information.infoTitle}</h1>
	</div>
	<div id="commons">
		<div class="container-fluid">
			<div class="row">
				<div class="col-sm-11">
					<p class="text-center">
					发布人:${view.information.createUser} 时间:${view.information.createTime} 发布范围:${view.information.selDataPerName} 
					<c:if test="${view.information.canComment=='1'}">
					<span class="label label-info">
					<i class="fa fa-commenting"></i>${view.commentsNum}
					</span>
					</c:if>
					</p>
				</div>
				<div class="col-sm-1">
					<p class="text-center">
					<button type="button" 
							title="栏目" 
							data-toggle="tooltip"
							data-placement="bottom"
							class="information-columngoBut" 
							data-id="${belongInfoColumn.columnId}">
							<i class="fa fa-list"></i>
					</button>
					</p>
				</div>
			</div>
			<div class="box-body no-padding">
				<div class="row">
					<div class="col-sm-12">
						<table class="table table-bordered">
							<tr>
	  							<th>选项名称</th>
	                            <th>投票人员</th>
	                            <th>统计</th>
	                            <th>操作</th>
							</tr>
							<c:forEach items="${view.infoVoteItemLog}" var="commenlog">
								<tr>
									<td>${commenlog.infoVoteItem.optionName}</td>
									<td></td>
									<td>共${commenlog.voteTotal}票</td>
									<td>
										<button type="button" 
											title="修改" 
											data-toggle="tooltip"
											data-placement="bottom"
											open-url="information/vote!input.action?pid=${view.information.infoId}&id=${commenlog.infoVoteItem.voteItemId}"
											class="btn btn-default btn-sm btn-open-form">
											<i class="fa fa-edit"></i>
										</button>
									</td>
								</tr>
							</c:forEach>
						</table>
						<table class="table table-bordered">
							<tr>
	  							<th>投票统计</th>
	                            <td>共${view.voteJoinNum}人参与投票</td>
							</tr>							
							<tr>
	  							<th>投票状态</th>
	                            <td>
	                            <c:if test="${view.information.voteStatus=='1'}">进行中</c:if>
	                            <c:if test="${view.information.voteStatus=='0'}">已结束</c:if>
	                            <c:if test="${empty view.information.voteStatus}">未开始</c:if>
	                            </td>
							</tr>							
						</table>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<!--底部操作区-->
				<div class="handlePanel">
					<a title="新建" open-url="information/vote!input.action?pid=${view.information.infoId}"
						class="a-btn btn-open-form"> <span class="fa fa-plus"></span>
						<span class="text">新建</span>
					</a>
					<a title="结束投票" 
						data-toggle="tooltip"
						data-placement="bottom"
						do-url="information/vote!finishVote.action?id=${view.information.infoId}"
						load-url="information/vote!list.action?id=${view.information.infoId}" load-container="div.right"
						confirm-msg="确定要结束投票吗？"
						class="a-btn btn-open-confirm-win"> 
						<span class="fa fa-hourglass-end"></span>
						<span class="text">结束投票</span>
					</a>
					<a title="重新投票" 
						data-toggle="tooltip"
						data-placement="bottom"
						do-url="information/vote!restartVote.action?id=${view.information.infoId}"
						load-url="information/vote!list.action?id=${view.information.infoId}" load-container="div.right"
						confirm-msg="确定要重新投票吗？"
						class="a-btn btn-open-confirm-win"> 
						<span class="fa fa-hourglass-start"></span>
						<span class="text">重新投票</span>
					</a>
				</div>
			</div>						
<%-- 			<div class="row-fluid">
				<div class="span12">
					${view.information.infoContent}
				</div>				
			</div> --%>
		</div>
	</div>
</section>
<script>
	require(['util','list', 'thx-page','dialog'], function(util,list,page,dialog) {
		list.init();
		page.init('div.right');
		var ctxPath = "${pageContext.request.contextPath}";
		// 返回栏目列表
		$(".information-columngoBut").click(
			function() {
				var data_id = $(this).attr("data-id");
				var href = ctxPath
						+ '/information/information!list.action?columnId='+data_id;
				util.ajaxPage(href,'',true,'div.right');
		});
	});
</script>

